package com.jiyun.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jiyun.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jiyun.vo.UserVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 聪哥哥
 * @since 2023-05-05
 */
public interface UserMapper extends BaseMapper<User> {

    Page<UserVo> findPage(Page<UserVo> userVoPage, @Param("u") UserVo userVo);

    List<UserVo> findAllUserVo();

    @Select(" select u.*  from user u,user_role ur where u.id=ur.uid  and ur.rid=#{rid} ")
    List<User> findAllUser(@Param("rid") Integer rid);

    @Select(" select * from user where id not in (select uid from user_role ur where rid=#{rid}) ")
    List<User> findAllUser4Choose(@Param("rid")Integer rid);
}
